<?php

use yii\db\Migration;

class m191231_031945_banner extends Migration
{
    /**
     * {@inheritdoc}
     */
    public function safeUp()
    {
        $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB COMMENT="banner表"';
        $this->createTable('{{%banner}}', [
            'id' => $this->primaryKey(),
            'title' => $this->string()->notNull()->comment('标题'),
            'pic' => $this->string()->notNull()->comment('项目图'),
            'status' => $this->smallInteger()->notNull()->defaultValue(1)->comment('状态： 1为正常，2为停用,3为删除 '),
            'url' => $this->string()->defaultValue('')->comment('跳转链接'),
            'created_at' => $this->integer()->notNull(),
            'updated_at' => $this->integer()->notNull(),
            'deleted_at' => $this->integer(),
        ],$tableOptions);

    }

    /**
     * {@inheritdoc}
     */
    public function safeDown()
    {
        $this->dropTable('{{%banner}}');

        return false;
    }
    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}
